package com.jimmy.medical.repository;

import com.jimmy.medical.entity.PhoneCall;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface PhoneCallRepository extends JpaSpecificationExecutor<PhoneCall>, PagingAndSortingRepository<PhoneCall, Long> {

    @Query("select c from PhoneCall c left join c.flowOrder f where f.id=?1 and c.type=?2")
    public List<PhoneCall> findCallsByFlowOrderId(Long flowOrderId, String type);
}
